home *** CD-ROM | disk | FTP | other *** search
-
- /*
- initclut.c
-
- 5/1/89
- c. keith ray
-
- procedure to initialize color lookup table
- based on code from IMAGE
- */
-
- #include "initclut.h"
- #include "about_alert.h"
- #include <IM1_5Protos.h>
-
- #define NIL 0
-
- extern WindowPtr Result_Window; /* Window pointer */
- extern WindowPtr proton_Window; /* Window pointer */
- extern WindowPtr flourine_Window;
-
- PaletteHandle mypalette;
- RGBColor BlackRGB, whiteRGB, grayRGB;
-
- void Init_gray_clut()
- {
- short jk, col;
- /*
- create a single Palette that will be shared with all my windows and hopefully,
- the offscreen pixmap as well.
- */
- unsigned short i, j;
-
- mypalette = NewPalette(all_my_colors, 0L, pmTolerant, 0);
- /* requires exact matches to specified colors */
-
- col = maxintensity;
- for ( jk = 0; jk < all_my_colors; jk++ )
- {
- grayRGB.red = col;
- grayRGB.blue = col;
- grayRGB.green = col;
- SetEntryColor(mypalette, jk, &grayRGB);
- col -= (maxintensity / all_my_colors);
- }
- BlackRGB.red = 0;
- BlackRGB.blue = 0;
- BlackRGB.green = 0;
-
- whiteRGB.red = maxintensity;
- whiteRGB.blue = maxintensity;
- whiteRGB.green = maxintensity;
-
- grayRGB.red = maxintensity / 2;
- grayRGB.blue = maxintensity / 2;
- grayRGB.green = maxintensity / 2;
- }
-
-
- void init_clut_flourine() /* source 1 */
- {
- short i;
-
- SetPalette( flourine_Window, mypalette, TRUE);
- RGBBackColor(&whiteRGB);
- RGBForeColor(&BlackRGB); /* copybits usually expect black fore and white back */
- OpColor(&grayRGB);
-
- ActivatePalette( flourine_Window );
-
- }
-
- void init_clut_proton() /* source 2 */
- {
- short i;
-
- SetPalette( proton_Window, mypalette, TRUE);
- RGBBackColor(&whiteRGB);
- RGBForeColor(&BlackRGB); /* copybits usually expect black fore and white back */
- OpColor(&grayRGB);
- ActivatePalette( proton_Window );
-
- }
-
- void myForeColor( r, g, b )
- unsigned short r, b, g;
- /* makes it easier to do RGBForeColor */
- {
- RGBColor mycolor;
-
- mycolor.red = r;
- mycolor.green = g;
- mycolor.blue = b;
- RGBForeColor( &mycolor );
- }
-
- void myBackColor( r, g, b )
- unsigned short r, b, g;
- /* makes it easier to do RGBBackColor */
- {
- RGBColor mycolor;
-
- mycolor.red = r;
- mycolor.green = g;
- mycolor.blue = b;
- RGBBackColor( &mycolor );
- }
-
- void init_clut_result( )
- {
- short i;
-
- SetPalette( Result_Window, mypalette, TRUE);
- RGBBackColor(&whiteRGB);
- RGBForeColor(&BlackRGB); /* copybits usually expect black fore and white back */
- OpColor(&grayRGB);
- ActivatePalette( Result_Window );
- for ( i = 0; i < all_my_colors; i++ )
- {
- ProtectEntry(i, TRUE);
- }
- }
-